/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sgsmcan.Entidad;

import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author David
 */
@Entity
@Table(name = "evento_has_sereno_has_perro")
public class EventoSerenoPerro implements Serializable {

    @EmbeddedId
    @AttributeOverrides({
        @AttributeOverride(name = "eventoId", column = @Column(name = "Evento_id", nullable = false)),
        @AttributeOverride(name = "serenoHasPerroIdSereno", column = @Column(name = "Sereno_has_Perro_idSereno", nullable = false)),
        @AttributeOverride(name = "serenoHasPerroIdPerro", column = @Column(name = "Sereno_has_Perro_idPerro", nullable = false))})
    private EventoSerenoPerroId esp = new EventoSerenoPerroId();

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "Evento_id", nullable = false, insertable = false, updatable = false)
    private Evento evento;

    @ManyToOne(fetch=FetchType.EAGER)
    @JoinColumns( { 
        @JoinColumn(name="Sereno_has_Perro_idSereno", referencedColumnName="idSereno", nullable=false, insertable=false, updatable=false), 
        @JoinColumn(name="Sereno_has_Perro_idPerro", referencedColumnName="idPerro", nullable=false, insertable=false, updatable=false) } )
    private SerenoPerro serenoPerro;

    public EventoSerenoPerro() {
    }

    public EventoSerenoPerroId getEsp() {
        return esp;
    }

    public void setEsp(EventoSerenoPerroId esp) {
        this.esp = esp;
    }

    public Evento getEvento() {
        return evento;
    }

    public void setEvento(Evento evento) {
        this.evento = evento;
    }

    public SerenoPerro getSerenoPerro() {
        return serenoPerro;
    }

    public void setSerenoPerro(SerenoPerro serenoPerro) {
        this.serenoPerro = serenoPerro;
    }
}
